package com.ruoyi.school.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.exception.base.BaseException;
import com.ruoyi.school.domain.PacCertType;
import com.ruoyi.school.service.PacCertTypeService;
import com.ruoyi.school.mapper.PacCertTypeMapper;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;

import static com.ruoyi.common.utils.PageUtils.startPage;

/**
* @author jeremylin
* @description 针对表【pac_cert_type(证书类型)】的数据库操作Service实现
* @createDate 2025-05-27 17:57:42
*/
@Service
public class PacCertTypeServiceImpl extends ServiceImpl<PacCertTypeMapper, PacCertType>
    implements PacCertTypeService{

    @Override
    public List<PacCertType> getList(PacCertType rePacCertType) {
        List<PacCertType> list = lambdaQuery().list();
        return list;
    }

    /**
     * 获取详情
     *
     * @param rePacCertType
     * @return
     */
    @Override
    public PacCertType getDetails(PacCertType rePacCertType) {
        if(rePacCertType.getId()==null){
            throw new BaseException("id不能为空");
        }
        PacCertType one = lambdaQuery().eq(PacCertType::getId, rePacCertType.getId()).one();
        return one;
    }

    /**
     * 新增数据
     *
     * @param rePacCertType
     * @return
     */
    @Override
    public boolean add(PacCertType rePacCertType) {
        if(save(rePacCertType)){
            return true;
        }
        return false;
    }

    /**
     * 编辑数据
     *
     * @param rePacCertType
     * @return
     */
    @Override
    public boolean edit(PacCertType rePacCertType) {
        if(updateById(rePacCertType)){
            return true;
        }
        return false;
    }

    /**
     * 删除数据
     *
     * @param rePacCertType
     * @return
     */
    @Override
    public boolean delete(PacCertType rePacCertType) {
        if(removeById(rePacCertType)){
            return true;
        }
        return false;
    }

    /**
     * 获取所有的成果等级
     *
     * @param rePacCertType
     * @return
     */
    @Override
    public List<PacCertType> getAllList(PacCertType rePacCertType) {
        List<PacCertType> list = lambdaQuery().list();
        return list;
    }
}




